Skip to content

Conversation

g0t4
Copy link

@g0t4 g0t4 commented Oct 3, 2025

Is there interest in generating fish completions? If so, I will do a thorough review and make any requested changes. See below for a TODO list and let me know what to add.

Full disclosure, I used Claude Code (Sonnet 4.5) to generate this while testing the model's capabilities and I was pleasantly surprised. Upon cursory review and testing it works.

Testing

# ensure no existing completions
llama-server --<TAB>
# nothing should appear

# generate and load on-the-fly (process substitution)
source (llama-server --completion-fish | psub)

# test
llama-server --<TAB>
# completions should appear

TODOs

  • Reduce overlap with --completion-bash, i.e. list of executables
  • Fix "executable list is not quite correct" noted by @slaren below
    • some of these programs don't use the common lib to parse the command line
      • like llama-bench, llama-quantize, llama-simple
    • and only the tools should need completions, not the examples
    • IIAC bash side needs fixed too?
  • Compare to generated bash completions for anything that is missing
    • i.e. find out why -h<TAB> doesn't list -hf and similar single dash options
  • Ensure code follows all guidelines
  • Review escaping of strings
  • Review complete argument generation, i.e. -s/l
  • Rename bash equivalents?
    • common_params_print_completion(...) => common_params_print_completion_bash(...)
    • params.completion => params.completion_bash
  • Do you want automated testing? If so please expand/shrink this list:
    • run llama-server --completion-fish and ensure zero exit code + generates output
    • optional - source it (like above) to make sure it doesn't fail
    • optional - unit tests for options/escaping logic
    • I don't see tests of --completion-bash, but would be happy to add some for it too, could do that in a separate PR too
  • Suppress some (or all) of STDERR when generating? i.e. llama-server --completion-[fish/bash]?
  • Generate files into ~/.cache/fish/generated_completions
    • Can I ask fish shell for location? So I don't have to replicate any logic in this repo?
    • and/or add smth like --completion-fish-path <PATH|->
    • - means STDOUT
    • make sure help notes include explanations of args

@g0t4 g0t4 requested a review from ggerganov as a code owner October 3, 2025 06:46
@tommarques56

This comment was marked as spam.

@slaren
Copy link
Member

slaren commented Oct 6, 2025

Add guidance to header for where to put the generated file?

* i.e. `~/.config/fish/completions/llama-server.fish`

* but that won't auto load for anything but llama-server

Yes, this is a problem. The way fish loads completions, it may be necessary to generate a completions file for each command. I also noticed that the executable list is not quite correct, some of these programs don't use the common lib to parse the command line, like llama-bench, llama-quantize, llama-simple, and only the tools should need completions, not the examples. Once these are removed from the list, the number of programs that need a completions file should be more manageable.

@g0t4
Copy link
Author

g0t4 commented Oct 7, 2025

@slaren yeah per command is gonna be best, and saved into user's completions dir ~/.config/fish/completions/<command>.fish

beyond that I assume package maintainers can add them to a system wide location as needed...

I'll work on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants